import java.util.Scanner;

public class demo01 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] left=new int[n];
        int[] right=new int[n];
        for (int i = 0; i < n; i++) {
            left[i]=sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            right[i] = sc.nextInt();
        }
        int num=findMinimum(n,left,right);
        System.out.println(num);
    }
    public static int findMinimum(int n, int[] left, int[] right) {
        int leftsum=0;
        int rightsum=0;
        int sum=0;
        int leftmin=Integer.MAX_VALUE;
        int rightmin=Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            if(left[i]*right[i]==0){
                sum+=left[i]+right[i];
            }else {
                if(leftmin>left[i]){
                    leftmin=left[i];
                }
                if(rightmin>right[i]){
                    rightmin=right[i];
                }
                leftsum += left[i];
                rightsum += right[i];
            }
        }
        return Math.min(leftsum-leftmin+1,rightsum-rightmin+1)+sum+1;
    }
}
